<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--@thymesVar id="user" type="ru.tbcarus.spendingsb.model.User"-->
<!--@thymesVar id="Role" type="ru.tbcarus.spendingsb.model.Role"-->
<nav th:fragment="bodyHeader" class="navbar navbar-expand-md navbar-dark bg-dark py-0">
    <script th:src="@{/js/util.js}"></script>
    <script th:src="@{/js/group.js}"></script>
    <div class="container-fluid p-1">
        <div class="navbar-collapse collapse" id="navbarCollapse" style="">
            <ul class="navbar-nav me-auto mb-2 mb-md-0">
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" th:href="@{/payments}">Главная</a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="true" href="#">Добавить
                        <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <form th:if="${user.isSuperUser()}" id="add_friend" th:action="@{/group/addfriend}" method="post">

                            <li class="m-1">
                                <input class="col-4 me-2" type="text" placeholder="Email" name="email" id="email"
                                       style="border-radius:5px; width: 150px">
                            </li>
                            <li class="m-1">
                                <button class="btn btn-success col-1" type="submit" id="btnAddFriend"
                                        style="width: 150px">
                                    Отправить
                                </button>
                            </li>
                        </form>

<!--                        <li class="m-1">-->
<!--                            <button class="btn btn-info col-1" id="btnAddFriendRest"-->
<!--                                    onclick="addFriend()" style="width: 150px">-->
<!--                                Отправить REST-->
<!--                            </button>-->
<!--                        </li>-->

                        <li class="m-1" th:if="${user.isSuperUser()}">
                            <input class="btn btn-danger" type="button" value=" Invites " style="width: 150px"
                                   th:onclick="|window.location.href='@{/profile/invites}'|">
                        </li>
                        <li class="m-1">
                            <input class="btn btn-info" type="button" value=" My group " style="width: 150px"
                                   th:onclick="|window.location.href='@{/group}'|">
                        </li>
                    </ul>
                </li>
                <li>
                    <a class="nav-link active" aria-current="page" th:href = "@{/info}">Info</a>
                </li>
            </ul>
            <div class="me-2">
                <span class="text-success" th:if="${user.isUser()}" th:text="U"></span>
                <span class="text-success" th:if="${user.isSuperUser()}" th:text="SU"></span>
                <span class="text-success" th:if="${user.isAdmin()}" th:text="A"></span>
            </div>

            <div class="me-2">
                <a class="btn btn-info" th:if="${user.isAdmin()}" th:href="@{/admin/users}">Пользователи</a>
            </div>
            <div class="ms-2">
                <a th:href="@{/profile/notes}">
                    <img th:if="${user.isNewNotify()}" th:src="@{/images/bell-active.png}" width="32">
                    <img th:unless="${user.isNewNotify()}" th:src="@{/images/bell.png}" width="32">
                </a>
            </div>
            <div class="ms-2">
                <form th:action="@{/logout}" method="post">
                    <button class="btn btn-outline-success" type="submit">
                        <img th:src="@{/images/icon-exit.gif}" width="32">
                    </button>
                </form>
            </div>
        </div>
    </div>
</nav>

</body>
</html>